<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>留言管理修改</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__ADMIN__css/bootstrap.min14ed.css" rel="stylesheet">
    <link href="__ADMIN__css/font-awesome.min93e3.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="__ADMIN__css/animate.min.css" rel="stylesheet">
    <link href="__ADMIN__css/style.min862f.css" rel="stylesheet">
    <link href="__ADMIN__js/plugins/layer/skin/layer.css" rel="stylesheet">
    <link href="__ADMIN__css/plugins/switchery/switchery.css" rel="stylesheet">
</head>
<body calss="gray-by">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>修改留言</h5>
                </div>
                <div class="ibox-content">
                    <form method="post" name="forma" id="forma" enctype="multipart/form-data" action="{:U('Admin/Leaver/addSave')}" class="form-horizontal">
                        <input type="hidden" name="id" value="{$list.id}">
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">留言内容</label>
                            <div class="col-sm-10">
                                <input type="text" name="content" id="content" class="form-control" value="{$list.content}">
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="submit">保存内容</button>
                                <button class="btn btn-white" type="reset" onclick="history.go(-1)">取消</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="__ADMIN__js/jquery.min.js"></script>
<script src="__ADMIN__js/bootstrap.min.js"></script>
<script src="__ADMIN__js/plugins/layer/layer.min.js"></script>
<script src="__ADMIN__js/plugins/switchery/switchery.js"></script>
<script src="__ADMIN__js/plugins/validate/jquery.validate.min.js"></script>
<script src="__ADMIN__js/plugins/validate/messages_zh.min.js"></script>
<script src="__ADMIN__js/common.js"></script>
<script>
    $(function() {
        $("#forma").validate({
            rules: {
               content:"required"
            },
            messages: {
               content:'留言内容不能为空！'
            },
            submitHandler: function(form){
                var forma = new FormData(document.getElementById('forma'));
                $.ajax({
                    url:$(form).attr('action'),
                    type:'post',
                    dataType:'json',
                    data:forma,
                    cache:false,
                    processData:false,
                    contentType:false,
                    success:function(data){
                        console.log(data.status);
                       if(data.status > 0){
                           layer.msg(data.msg, {icon: 5, time: 1000, anim: 6});
                       }else{
                           layer.msg(data.msg, {icon: 6, time: 1000, anim: 6},function(){
                               window.location = "{:U('Admin/Leaver/index')}";
                           });
                       }
                    }
                });
            }
        })
    });

</script>